Crate bevy_fly_camera[−][src]
A simple plugin and components for 2d/3d flying cameras in Bevy.
3D
Movement system is based on Minecraft, flying along the horizontal plane no matter the mouse’s vertical angle, with two extra buttons for moving vertically.
Default keybinds are:
- W / A / S / D - Move along the horizontal plane
- Shift - Move downward
- Space - Move upward
Example
use bevy::prelude::*;
use bevy_fly_camera::{FlyCamera, FlyCameraPlugin};
fn setup(commands: &mut Commands) {
commands
.spawn(Camera3dBundle::default())
.with(FlyCamera::default());
}
fn main() {
App::build()
.add_plugins(DefaultPlugins)
.add_startup_system(setup.system())
.add_plugin(FlyCameraPlugin)
.run();
}
There’s also a basic piece of example code included in /examples/basic.rs
2D
Movement system only uses the keyboard to move in all four directions across the 2d plane.
The default keybinds are:
- W / A / S / D - Move along the 2d plane
Example
use bevy::prelude::*;
use bevy_fly_camera::{FlyCamera2d, FlyCameraPlugin};
commands
.spawn(Camera2dBundle::default())
.with(FlyCamera2d::default());
There’s also a basic piece of example code included in /examples/2d.rs
Structs
FlyCamera | A set of options for initializing a FlyCamera.
Attach this component to a |
FlyCamera2d | A set of options for initializing a FlyCamera.
Attach this component to a |
FlyCameraPlugin | Include this plugin to add the systems for the FlyCamera bundle. |